/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.dao.impl;

import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import thienphuc.patient.dao.AbstractHibernateDaoSupport;
import thienphuc.patient.dao.ThongTinBenhNhanDAO;
import thienphuc.patient.dto.ThongTinBenhNhan;

/**
 *
 * @author QuocDat
 */
public class ThongTinBenhNhanDAOImpl extends AbstractHibernateDaoSupport<ThongTinBenhNhan, Integer> implements ThongTinBenhNhanDAO {

    public ThongTinBenhNhanDAOImpl(Class<ThongTinBenhNhan> classPersistent) {
        super(classPersistent);
    }

    public List<ThongTinBenhNhan> findByTenBenhNhan(String tenBenhNhan) throws Exception {
        Criterion criterionTenBenhNhan = Restrictions.like(THONG_TIN_BENH_NHAN_TEN_BENH_NHAN, "%" + tenBenhNhan + "%");
        return this.findByCriteria(criterionTenBenhNhan);
    }

    public List<ThongTinBenhNhan> findByPhai(boolean phai) throws Exception {
        return this.findByProperty(THONG_TIN_BENH_NHAN_PHAI, phai);
    }

    public List<ThongTinBenhNhan> findByNamSinh(int namSinh) throws Exception {
        return this.findByProperty(THONG_TIN_BENH_NHAN_NAM_SINH, namSinh);
    }
}
